package com.payment.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import com.payment.domain.PaymentCommand;
import com.point.domain.PointCommand;

@Component
public class PaymentDaoImpl extends SqlSessionDaoSupport implements PaymentDao{
	@Override
	public List<PaymentCommand> list(Map<String, Object> map) {
		List<PaymentCommand> list = getSqlSession().selectList("Payment.selectList",map);
		return list;
	}
	
	@Override
	public void insertPayment(PaymentCommand payment) {
		getSqlSession().insert("Payment.insertPayment",payment);		
	}	
	
	@Override
	public int getRowCount(Map<String, Object> map) {
		return getSqlSession().selectOne("Payment.selectCount",map);
	}
	
	@Override
	public int selectPointSum(PointCommand point) {
		return getSqlSession().selectOne("Payment.selectPointSum", point);
	}

	@Override
	public int selectMemberNpoint(String id) {
		return getSqlSession().selectOne("Payment.selectMemberNpoint", id);
	}

	@Override
	public List<PointCommand> selectPointList(Map<String, Object> map) {
		List<PointCommand> list = getSqlSession().selectList("Payment.selectMinusPointList",map);
		return list;
	}

	@Override
	public int getPointRowCount(Map<String, Object> map) {
		return getSqlSession().selectOne("Payment.selectPointCount",map);
	}
}